package com.ponhu.ea2.stockcenter.provider.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.io.Serializable;
import java.util.Date;

import lombok.Data;
import lombok.experimental.Accessors;

/**
 * 库存单据占用表(包括销售单；采退单)
 *
 * @TableName ph_stock_inventory_doc_occupy
 */
@Data
@Accessors(chain = true)
@TableName(value = "ph_stock_inventory_doc_occupy")
public class StockInventoryDocOccupy implements Serializable {

    /**
     * 主键
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 单据号(包括销售单/采退单等)
     */
    private String docNo;

    /**
     * 单据类型(0:OMS; 2: 采购中心 )
     */
    private Integer docType;

    /**
     * 货品编码
     */
    private String inventoryCode;

    /**
     * 占用数量
     */
    private Integer usedNum;

    /**
     * 是否占用
     */
    private Boolean isUsed;

    /**
     * 状态(1:已下单；2:已出库；3:已取消)
     * {@link com.ponhu.ea2.stockcenter.provider.support.enums.DocOccupyStatusEnum}
     */
    private Integer status;

    /**
     * 单据调拨状态(1:未出可售仓；2:调拨已申请未出库；3:调拨已申请已出库)
     * {@link com.ponhu.ea2.stockcenter.provider.support.enums.DocOccupyTransferStatusEnum}
     */
    private Integer docTransferStatus;

    /**
     * 备注
     */
    private String remark;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    @TableField(fill = FieldFill.UPDATE, update = "NOW()")
    private Date updateTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    public Integer getUsedNumAbs() {
        return Math.abs(usedNum);
    }

}